package com.lxp.eduService.controller;


import com.lxp.eduService.domain.vo.subject.OneSubject;
import com.lxp.eduService.service.EduSubjectService;
import com.lxp.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author lxp
 * @since 2021-11-18
 */
@RestController
@RequestMapping("/eduService/edu-subject")
public class EduSubjectController {
    @Autowired
    private EduSubjectService service;

    //添加课程
    @PostMapping("/addSubject")
    public R addSubject(MultipartFile file){ //根据Excel获取课程

        service.saveSubject(file);
        return R.ok();
    }

    //获取课程信息表
    @GetMapping("/getSubjectList")
    public R getSubjectList(){

        List<OneSubject> list=service.getFinalSubject();
        return R.ok().data("list",list);
    }
}

